<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>
<script type="text/javascript">
//选择事件
function S_NodeCheck(e, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId),
        nodes = zTree.getCheckedNodes(true)
    var ids = '', names = ''
    
    for (var i = 0; i < nodes.length; i++) {
        ids   += ','+ nodes[i].id
        names += ','+ nodes[i].name
    }
    if (ids.length > 0) {
        ids = ids.substr(1), names = names.substr(1)
    }
    $("#parentId1").val(ids);
    var $from = $('#'+ treeId).data('fromObj')
    
    if ($from && $from.length) $from.val(names)
}
//单击事件
function S_NodeClick(event, treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj(treeId)
    
    zTree.checkNode(treeNode, !treeNode.checked, true, true)
    
    event.preventDefault()
}


</script>

<div class="bjui-pageContent">
    <form action="${ctx}/management/menu/add.do" data-toggle="validate" data-reload-navtab="true">
        <div class="pageFormContent" data-layout-h="0">
            <table class="table table-condensed table-hover" width="100%">
                <tbody>
                	<tr>
                        <td colspan="2">
                            <label class="control-label x100">所属系统：</label>
                             <select class="selectpicker show-tick" name="sysCode" data-style="btn-default btn-sel" data-width="auto">
                           		<c:forEach var="sysObj" items="${systemList}">
                           			 <option value="${sysObj.sysCode}">${sysObj.attrName}</option>
                            	 </c:forEach>
	                        </select>
                        </td>
                    </tr>
                    
                	<tr>
                        <td colspan="2">
                            <label class="control-label x100">父菜单：</label>
                           <input type="hidden" id="parentId1"  name="parentId" value="">
				             <input type="text" id="parentName" name="parentName" value="${param.parentName}" data-toggle="selectztree" size="18" data-tree="#addMenuTree" readonly>
				              <ul id="addMenuTree" class="ztree hide" data-toggle="ztree" data-expand-all="true" data-check-enable="true" data-chk-style="radio" data-radio-type="all" data-on-check="S_NodeCheck" data-on-click="S_NodeClick">
				              	<c:forEach var="menu" items="${menuList}">
				               	 	<li data-id="${menu.intID}" data-pid="${menu.parentId}">${menu.menuName}</li>
				                </c:forEach>
				            </ul>
				          </td>
                    </tr>
                    
                    <tr>
                        <td colspan="2">
                            <label class="control-label x100">菜单对象：</label>
                            <input type="text" name="menuModel"  data-rule="required" value="" size="30">
                        </td>
                    </tr>
                    
                    <tr>
                        <td colspan="2">
                            <label class="control-label x100">菜单名：</label>
                            <input type="text" name="menuName"  data-rule="required" value="" size="30">
                        </td>
                    </tr>
                      <tr>
                        <td colspan="2">
                            <label class="control-label x100">菜单路径：</label>
                            <input type="text" name="menuUrl"  value="" size="30">
                        </td>
                    </tr>
                      <tr>
                        <td colspan="2">
                            <label class="control-label x100">是否默认加载：</label>
                             <select class="selectpicker show-tick" id="menuTarget" name="menuTarget" data-style="btn-default btn-sel" data-width="auto">
	                            <option value="noactive">不加载</option>
	                            <option value="active" >加载</option>
	                        </select>
                        </td>
                    </tr>
                      <tr>
                        <td colspan="2">
                            <label class="control-label x100">排序：</label>
                            <input type="text" name="intOrder" value="" data-rule="digits"  data-width="auto">
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </form>
</div>

<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn-close" data-icon="close">关闭</button></li>
        <li><button type="submit" class="btn-default" data-icon="save">保存</button></li>
    </ul>
</div>